<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.onkeyup 某个键盘按键被松开时触发
        // document.onkeyup=function(){
        //     console.log('我弹起了');
        // }
        document.addEventListener('keyup',function(){
            console.log('我又弹起了up');
        })
            // 2.onkeydown 某个键盘按键被按下时触发
            document.addEventListener('keydown',function(){
                console.log('我被按下了down');
            })
            // 3.onkeypress 某个键盘按键被按下时触发  但它不识别功能按键 
            // 如ctrl shifr 箭头等
            document.addEventListener('keypress',function(){
                console.log('我有被按下了press');
            })
            //三个事件的执行顺序 keydown -- keypress --keyup
    </script>
</body>
</html>